package com.common.retrofit.methods;

import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.entity.result.HomeRecommendBean;
import com.common.retrofit.service.HaiNingService;

import java.util.ArrayList;

import rx.Observable;
import rx.Subscriber;

public class HomeRecommedHouseMethods extends BaseMethods {

    private static HomeRecommedHouseMethods m_ins = null;

    public static HomeRecommedHouseMethods getInstance() {
        if (m_ins == null) {
            synchronized (HomeRecommedHouseMethods.class) {
                if (m_ins == null) {
                    m_ins = new HomeRecommedHouseMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "Index/";
    }

    private HaiNingService initService() {
        return getRetrofit().create(HaiNingService.class);
    }

    // 获取首页数据
    public void homeRecommend(Subscriber<ArrayList<HomeRecommendBean>> subscriber, int page,String city) {
        Observable observable = initService().homeRecommend(System.currentTimeMillis()+"",
                "9afa5acad4feac1de1f291fda0a70f88",page,city
        );
        toSubscribe(observable, subscriber);
    }
}
